# -*- coding: utf-8 -*-

def clean_str(s):
    return unicode(s).replace('\r', '').strip()

def bulkreplace(s, rules):
    for old, new in rules:
        if isinstance(old, basestring):
            s = s.replace(old, new)
        else:
            s = old.sub(new, s)        
    return s 